// Learn TypeScript:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

@ccclass
export default class handMove extends cc.Component {

    @property(cc.Node)
    hand: cc.Node = null;

    @property()
    isFourThreeLevel:boolean = false;

    onLoad () {
        if(!this.isFourThreeLevel)
        {
            this.node.on("touchstart",this.TouchStart,this);
            this.actionFun();
        }else{
            cc.tween(this.hand).repeatForever(
                cc.tween(this.hand)
                    .to(0.2,{scale : 1.2})
                    .to(0.2,{scale : 1})
            ).start();
        }
        
    }

    start () {

    }
    actionFun()
    {
        cc.tween(this.hand).repeatForever(
            cc.tween(this.hand)
                .by(1,{y:-150})
                .call(()=>{
                    this.hand.position = new cc.Vec3(50,250,0);
                })
        ).start();
    }

    TouchStart()
    {
        this.node.off("touchstart",this.TouchStart,this);
        this.node.destroy();
    }

    // update (dt) {}
}
